/**
 * 
 */
package org.ccay.log.connection.impl;

import javax.inject.Named;

import org.ccay.core.exception.ApplicationException;
import org.ccay.core.log.CcayLoggerFactory;
import org.ccay.core.log.ILogger;
import org.ccay.core.server.IAfterStartupHandler;
import org.ccay.core.server.StartupEventArgs;
//import org.ccay.registry.util.RegistryQueryUtil;


/**
 * ConnectionLog启动处理器
 * @author chaowangbang
 * @since 2013-03-15
 */
@Named
public class ConnectionLogStartupHandler implements IAfterStartupHandler {
	/**
	 * 打印日志
	 */
	private static final ILogger logger = CcayLoggerFactory.getLogger(ConnectionLogStartupHandler.class);
	
	/**
	 * 系统启动时初始化总开关
	 * (non-Javadoc)
	 */
	public void execute(Object sender, StartupEventArgs args)
			throws ApplicationException {
		
		boolean switchValue = true;//RegistryQueryUtil.getBooleanValue("Ccay.Logs.EnableConnectionLog");
		if(switchValue){
			ConnectionLogStatusManager.setLogEnabled(true);
			logger.debug("Value of EnableConnectionLog is "+switchValue);
			return;
		}
		ConnectionLogStatusManager.setLogEnabled(false);
		logger.debug("Value of EnableConnectionLog is "+switchValue);
	}
	public int getOrder() {
		return 30;
	}

}
